package com.oliver.proxy.midjourney.infrastructure.repository;

import com.oliver.proxy.midjourney.domain.entity.TaskList;
import com.oliver.proxy.midjourney.domain.repository.TaskListRepository;
import com.oliver.proxy.midjourney.infrastructure.mapper.TaskListMapper;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public class TaskListRepositoryImpl implements TaskListRepository {
    private final TaskListMapper taskListMapper;

    public TaskListRepositoryImpl(TaskListMapper taskListMapper) {
        this.taskListMapper = taskListMapper;
    }

    @Override
    public Long save(TaskList taskList) {
        taskListMapper.insert(taskList);
        return taskList.getTaskId();
    }

    @Override
    public void update(TaskList taskList) {
        taskListMapper.update(taskList);
    }

    @Override
    public void delete(Long taskId) {
        taskListMapper.deleteById(taskId);
    }

    @Override
    public TaskList findById(Long taskId) {
        return taskListMapper.selectById(taskId);
    }

    @Override
    public List<TaskList> findAll() {
        return taskListMapper.selectAll();
    }

    @Override
    public List<TaskList> findByCategory(String category) {
        return taskListMapper.selectByCategory(category);
    }
} 